/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.rocketmq.client.impl.consumer;

import java.util.Set;
import org.apache.rocketmq.common.consumer.ConsumeFromWhere;
import org.apache.rocketmq.common.message.MessageQueue;
import org.apache.rocketmq.common.protocol.body.ConsumerRunningInfo;
import org.apache.rocketmq.common.protocol.heartbeat.ConsumeType;
import org.apache.rocketmq.common.protocol.heartbeat.MessageModel;
import org.apache.rocketmq.common.protocol.heartbeat.SubscriptionData;

/**
 * Consumer inner interface
 */
// 它记录consumer下接口对象
public interface MQConsumerInner {
    // 消费组名称
	String groupName();

	// BROADCASTING | CLUSTERING
    MessageModel messageModel();

    // PUSH | PULL
    ConsumeType consumeType();

    // 计算PullMessage该从什么偏移量开始消费
    ConsumeFromWhere consumeFromWhere();

    // 获取该消费对象下所订阅的topic所对应的SubscriptionData对象
    Set<SubscriptionData> subscriptions();

    // MessageQueue对象重新负载
    void doRebalance();

    // 将消费对象下的MessageQueue下的consumerQueueOffset持久化memory|store中
    void persistConsumerOffset();
    
    // 更新topic下的所有的MessageQueue集合对象
    void updateTopicSubscribeInfo(final String topic, final Set<MessageQueue> info);

    // 它用于去判断消费端对于该topic下的路由信息是否需要更新
    boolean isSubscribeTopicNeedUpdate(final String topic);

    // 判断是否为单元模式
    boolean isUnitMode();

    // 获取该消费对象运行状态信息
    ConsumerRunningInfo consumerRunningInfo();
}
